package com.freesky.web.manager.controller.search;

import com.freesky.common.utils.reponse.JSONResponse;
import com.freesky.web.manager.remote.search.SearchItemRemote;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author: 陈玉林
 * @modifiedBy:
 * @date: Create In 11:10 2018/12/14
 * @description:
 */
@Controller
@RequestMapping("/search")
@Api(description = "商品索引管理")
public class SearchController {
    @Autowired
    private SearchItemRemote searchItemRemote;

    @GetMapping("/manage-index/page")
    public String page() {
        return "search/manage-index";
    }

    @ResponseBody
    @GetMapping(value = "/importIndex")
    @ApiOperation(value = "导入商品索引至Solr")
    public JSONResponse importIndex(){
        return searchItemRemote.importIndex();
    }

    @ResponseBody
    @GetMapping(value = "/getInfo")
    @ApiOperation(value = "获取搜索引擎信息")
    public JSONResponse getInfo(){
        JSONResponse info = searchItemRemote.getInfo();
        return info;
    }
}
